$.fn.cghtcombogrid = function (param, htType) {
    var paramOptions = param || {};
    paramOptions.page = (typeof paramOptions.page == "undefined") ? 10 : paramOptions.page;
    paramOptions.wzjhId = (typeof paramOptions.wzjhId == "undefined") ? '' : paramOptions.wzjhId;
    var options = {
        panelWidth: 640,
        delay: 500,
        mode: 'remote',
        idField: 'id',
        textField: 'htbm',
        fitColumns: true,
        pagination: true,//是否分页
        collapsible: false,//是否可折叠的
        fit: true,//自动大小
        pageSize: paramOptions.page,//每页显示的记录条数，默认为10
        url: $.webPath() + '/htgl/cghtgl/cghtSimpleList?wzjhId=' + paramOptions.wzjhId + '&zt=ysp&htType=' + htType,
        columns: [
            [
                {field: 'htbm', title: '合同号', width: 55},
                {field: 'hzf_jc', title: '供应商', width: 70},
                {field: 'cglx', title: '类型', width: 25},
                {field: 'sbgs_jc', title: '申报公司', width: 60},
//                {field: 'sbbm_qc', title: '申报部门', width: 60},
                {field: 'qdrq', title: '签订日期', width: 30}
            ]
        ],
        loadFilter: function (data) {
            $.each(data.rows, function () {
                if (this.cglx) {
                    this.cglxz = this.cglx;
                    this.cglx = this.cglx == "bght" ? "保供合同" : this.cglx == "cgrk" ? "采购入库" : this.cglx == "zddh" ? "直达到货" : "统配合同";
                    this.zt = this.zt == 'yly' ? "已完结" : this.zt == 'yzz' ? "已终止" : this.zt == 'ytj' ? "已提交" : "已保存";
                }
            })

            return data;
        }
    };
    $.extend(options, paramOptions);
    $(this).combogrid(options);
}


$.fn.bzjCghtCombogrid = function (param) {
    var paramOptions = param || {};
    paramOptions.page = (typeof paramOptions.page == "undefined") ? 10 : paramOptions.page;
    var options = {
        panelWidth: 640,
        delay: 500,
        mode: 'remote',
        idField: 'id',
        textField: 'htbm',
        fitColumns: true,
        pagination: true,//是否分页
        collapsible: false,//是否可折叠的
        fit: true,//自动大小
        pageSize: 10,//每页显示的记录条数，默认为10
        url: $.webPath() + '/htgl/cghtgl/bzjCghtList',
        columns: [
            [
//                {field: 'id', title: 'ID', type:'hidden',width: 55},
                {field: 'htbm', title: '合同号', width: 70},
                {field: 'hsze', title: '含税总额', width: 50},
                {field: 'hzf_jc', title: '供应商', width: 70},
//                {field: 'cglx', title: '类型', width: 25},
                {field: 'sbgs_jc', title: '申报公司', width: 60},
                {field: 'qdrq', title: '签订日期', width: 30},
                {field: 'htms', title: '合同模式',width: 20,formatter: function (value) {
                    if (value == 'xsms') {
                        return "线上"
                    } else {
                        return "线下"
                    }
                }}
            ]
        ],
        loadFilter: function (data) {
            $.each(data.rows, function () {
                if (this.cglx) {
                    this.cglxz = this.cglx;
                    this.cglx = this.cglx == "bght" ? "保供合同" : this.cglx == "cgrk" ? "采购入库" : this.cglx == "zddh" ? "直达到货" : "统配合同";
                    this.zt = this.zt == 'yly' ? "已完结" : this.zt == 'yzz' ? "已终止" : this.zt == 'ytj' ? "已提交" : "已保存";
                }
            })
            return data;
        }
    };
    $.extend(options, paramOptions);
    $(this).combogrid(options);
}

$.fn.hthkCghtCombogrid = function (param) {
    var paramOptions = param || {};
    paramOptions.page = (typeof paramOptions.page == "undefined") ? 10 : paramOptions.page;
    var options = {
        panelWidth: 640,
        delay: 500,
        mode: 'remote',
        idField: 'id',
        textField: 'htbm',
        fitColumns: true,
        pagination: true,//是否分页
        collapsible: false,//是否可折叠的
        fit: true,//自动大小
        pageSize: 10,//每页显示的记录条数，默认为10
        url: $.webPath() + '/htgl/cghtgl/hthkCghtList',
        columns: [
            [
                {field: 'htbm', title: '合同号', width: 70},
                {field: 'hsze', title: '含税总额', width: 50},
                {field: 'hzf_jc', title: '供应商', width: 70},
                {field: 'sbgs_jc', title: '申报公司', width: 60},
                {field: 'qdrq', title: '签订日期', width: 30}
            ]
        ],
        loadFilter: function (data) {
            $.each(data.rows, function () {
                if (this.cglx) {
                    this.cglxz = this.cglx;
                    this.cglx = this.cglx == "bght" ? "保供合同" : this.cglx == "cgrk" ? "采购入库" : this.cglx == "zddh" ? "直达到货" : "统配合同";
                    this.zt = this.zt == 'yly' ? "已完结" : this.zt == 'yzz' ? "已终止" : this.zt == 'ytj' ? "已提交" : "已保存";
                }
            })
            return data;
        }
    };
    $.extend(options, paramOptions);
    $(this).combogrid(options);
}


$.fn.jgzsCghtCombogrid = function (param) {
    var paramOptions = param || {};
    paramOptions.page = (typeof paramOptions.page == "undefined") ? 10 : paramOptions.page;
    var options = {
        panelWidth: 680,
        delay: 500,
        mode: 'remote',
        idField: 'id',
        textField: 'htbm',
        fitColumns: true,
        pagination: true,//是否分页
        collapsible: false,//是否可折叠的
        fit: true,//自动大小
        pageSize: 10,//每页显示的记录条数，默认为10
        url: $.webPath() + '/htgl/cghtgl/jzjsCghtList',
        columns: [
            [
                {field: 'htbm', title: '合同号', width: 50},
                {field: 'hsze', title: '含税总额', width: 50},
                {field: 'order_sn', title: '订单号', width: 60},
              {field: 'hzf_jc', title: '供应商', width: 60},
                //   {field: 'sbgs_jc', title: '申报公司', width: 40},
                {field: 'qdrq', title: '签订日期', width: 30}
            ]
        ],
        loadFilter: function (data) {
            $.each(data.rows, function () {
                if (this.cglx) {
                    this.cglxz = this.cglx;
                    this.cglx = this.cglx == "bght" ? "保供合同" : this.cglx == "cgrk" ? "采购入库" : this.cglx == "zddh" ? "直达到货" : "统配合同";
                    this.zt = this.zt == 'yly' ? "已完结" : this.zt == 'yzz' ? "已终止" : this.zt == 'ytj' ? "已提交" : "已保存";
                }
            })
            return data;
        }
    };
    $.extend(options, paramOptions);
    $(this).combogrid(options);
}



$.fn.bzjZjCghtCombogrid = function (param) {
    var paramOptions = param || {};
    paramOptions.page = (typeof paramOptions.page == "undefined") ? 10 : paramOptions.page;
    var options = {
        panelWidth: 640,
        delay: 500,
        mode: 'remote',
        idField: 'id',
        textField: 'htbm',
        fitColumns: true,
        pagination: true,//是否分页
        collapsible: false,//是否可折叠的
        fit: true,//自动大小
        pageSize: 10,//每页显示的记录条数，默认为10
        url: $.webPath() + '/htgl/cghtgl/bzjCghtListForZj',
        columns: [
            [
                {field: 'htbm', title: '合同号', width: 70},
                {field: 'hsze', title: '含税总额', width: 50},
                {field: 'hzf_jc', title: '供应商', width: 70},
                {field: 'sbgs_jc', title: '申报公司', width: 60},
                {field: 'qdrq', title: '签订日期', width: 30},
                {field: 'htms', title: '合同模式',width: 20,formatter: function (value) {
                    if (value == 'xsms') {
                        return "线上"
                    } else {
                        return "线下"
                    }
                }}
            ]
        ],
        loadFilter: function (data) {
            $.each(data.rows, function () {
                if (this.cglx) {
                    this.cglxz = this.cglx;
                    this.cglx = this.cglx == "bght" ? "保供合同" : this.cglx == "cgrk" ? "采购入库" : this.cglx == "zddh" ? "直达到货" : "统配合同";
                    this.zt = this.zt == 'yly' ? "已完结" : this.zt == 'yzz' ? "已终止" : this.zt == 'ytj' ? "已提交" : "已保存";
                }
            })
            return data;
        }
    };
    $.extend(options, paramOptions);
    $(this).combogrid(options);
}


$.fn.bzjSkCombogrid = function (param, param1,param2) {
    var paramOptions = param || {};
    paramOptions.page = (typeof paramOptions.page == "undefined") ? 10 : paramOptions.page;
    var options = {
        panelWidth: 640,
        delay: 500,
        mode: 'remote',
        idField: 'id',
        textField: 'sfje',
        fitColumns: true,
        collapsible: false,//是否可折叠的
        fit: true,//自动大小
        pagination: true,//是否分页
        pageSize: 10,//每页显示的记录条数，默认为10
        url: $.webPath() + "/sfgl/sksh/findBzjSkList?gldwId=" + param + "&cghtId="+ param1+"&fplx="+param2,
        columns: [
            [
                {field: 'bm', title: '收款单号', width: 100},
                {field: 'sfje', title: '收款金额', width: 100},
                {field: 'ye', title: '收款余额', width: 100},
                {field: 'sfkrq', title: '收款日期', width: 100},
                {field: 'fkfs.z', title: '付款方式', width: 100},
                {field: 'fplx', title: '付款方式', width: 100, formatter: function (value) {
                    if (value == 0) {
                        return "非计划现货";
                    } else {
                        return "金融物流";
                    }
                }}
            ]
        ]
    };
    $.extend(options, paramOptions);
    $(this).combogrid(options);
}

$.fn.hthkSkCombogrid = function (param, param1) {
    var paramOptions = param || {};
    paramOptions.page = (typeof paramOptions.page == "undefined") ? 10 : paramOptions.page;
    var options = {
        panelWidth: 640,
        delay: 500,
        mode: 'remote',
        idField: 'id',
        textField: 'sfje',
        fitColumns: true,
        collapsible: false,//是否可折叠的
        fit: true,//自动大小
        pagination: true,//是否分页
        rownumbers: true,
        pageSize: 10,//每页显示的记录条数，默认为10
        url: $.webPath() + "/sfgl/sksh/findHthkSkList?gldwId=" + param + "&fplx=" + param1,
        columns: [
            [
                {field: 'bm', title: '收款单号', width: 100},
                {field: 'sfje', title: '收款金额', width: 100,formatter: function (value) {
                    var val = formatJeForHtml2(value);
                    return val;
                }},
                {field: 'ye', title: '收款余额', width: 100,formatter: function (value) {
                    var val = formatJeForHtml2(value);
                    return val;
                }
                },
                {field: 'sfkrq', title: '收款日期', width: 100},
                {field: 'fkfs.z', title: '付款方式', width: 100},
                {field: 'fplx', title: '付款方式', width: 100, formatter: function (value) {
                    if (value == 0) {
                        return "非计划现货";
                    } else {
                        return "金融物流";
                    }
                }}
            ]
        ]
    };
    $.extend(options, paramOptions);
    $(this).combogrid(options);
}





